<template>
  <!--计划回款-->
  <div>
    <!--全部-->
    <el-row style="margin-top: 15px">
      <span style="padding: 0 10px"><i class="font-14 el-icon-s-open"></i></span>
      <el-select v-model="filterValue" @change="initData(currPage,pageSize,filterValue,vagueValue,content)" placeholder="全部数据" style="width: 120px">
        <el-option v-for="group in filterOptions" :key="group.value"
                   :label="group.label" :value="group.value">
        </el-option>
      </el-select>
      <span style="padding: 0 10px 0 30px"><i class="fn el-icon-message-solid"></i></span>
      <el-input v-model="content" clearable placeholder="请输入内容" style="width: 150px"></el-input>
      <el-select v-model="vagueValue" @change="initData(currPage,pageSize,filterValue,vagueValue,content)" placeholder="客户名称" style="width: 120px">
        <el-option v-for="group in vagueOptions" :key="group.value"
                   :label="group.label" :value="group.value">
        </el-option>
      </el-select>
      <el-button @click="initData(currPage,pageSize,filterValue,vagueValue,content)" icon="el-icon-search" size="small" circle></el-button>
    </el-row>
    <!--新建计划回款-->
    <el-row style="margin-top: 10px">
      <el-col class="col-sm-交付计划6 text-left">
        <span set-lan="html:计划回款">计划回款</span>
        <small class="text-muted font-13">共{{totalSize}}条</small>
      </el-col>
      <el-col class="col-sm-6 text-right">
        <el-button type="text" @click="dialogFormVisible = true">
          <el-button size="small" icon="el-icon-circle-plus-outline">新建</el-button>
        </el-button>
      </el-col>
      <!--计划回款/应收表dialog-->
      <el-dialog title="计划回款/应收表" :visible.sync="dialogFormVisible" @open="openDialog" @close='closeDialog'  width="60%" style="color: #333333"  >
        <el-form :model="planreceivable" ref="plan" label-width="100px" :rules="rules">
          <hr style="margin-bottom: 15px">
          <el-row>
            <el-col :span="12">
              <el-form-item label="对应客户:" style="width: 830px" prop="customerByCustomerId.customerName">
                <el-input :disabled="true" v-model="planreceivable.customerByCustomerId.customerName"></el-input>
              </el-form-item>
              <div class="form-inline" v-show="isCustomer">
                <el-input v-model="customerValue" clearable @input="findCustomer" size="medium" placeholder="拼音.字母.关键字" style="width: 150px"></el-input>
                <el-button @click="findCustomer" size="medium" icon="el-icon-search"></el-button>
                <el-popover placement="top" v-model="visible">
                  <div style="margin-bottom: 10px">
                    <span>查询条件:{{customerValue}}</span>
                    <span @click="closeEmp" class="cursor" style="float: right"><i class="el-icon-error"></i></span>
                  </div>
                  <ul class="cu-ul" v-if="customerList2 !== ''">
                    <li @click="choiceCustomer2(item)" v-for="item in customerList2">{{item.customerName}}</li>
                  </ul>
                  <div style="margin: 5px 0;text-align: center" v-if="customerList2 == ''">
                    <i class="el-icon-warning-outline"/>没有符合条件的客户！
                  </div>
                </el-popover>
                <el-tooltip class="item" effect="dark" content="浏览选择客户" placement="bottom">
                  <el-button @click="innerVisible(cusCurrPage,cusPageSize)" size="medium" icon="el-icon-s-operation"></el-button>
                </el-tooltip>
              </div>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="合同订单:" prop="contractByContractId">
                <!--key绑定主键，要和select的value-key属性对应，引用字段名要一致，label用于显示内容，value值用来包含对象，用来提交-->
                <el-select v-model="planreceivable.contractByContractId" value-key="contractId" placeholder="未选" style="width: 730px">
                  <el-option v-for="item in contractList" :key="item.contractId" :label="item.contractTheme" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="计划回款日期:" style="width: 395px">
                <el-date-picker  type="date" placeholder="选择日期" style="width: 296px" v-model="planreceivable.planreceivableDate"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="期次:" prop="planreceivableIssue">
                <el-select v-model="planreceivable.planreceivableIssue" placeholder="未选"  style="width: 290px">
                  <el-option
                    v-for="item in periods"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="金额:" style="width: 395px" prop="planreceivableMoney">
                <el-input v-model="planreceivable.planreceivableMoney"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="负责人:" style="width: 370px" prop="employeeByEmpId.empName">
                <el-input style="width: 290px" :disabled="changeEmp" v-model="planreceivable.employeeByEmpId.empName" >
                  <el-button @click="openEmpDialog" slot="append" icon="el-icon-search"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="所有者:">
                <el-input :disabled="true" style="width: 730px" placeholder="boss">
                 <!-- <el-button slot="append" icon="el-icon-search" ></el-button>-->
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12" style="margin-left: 30px;margin-bottom: 20px">
              <span style="margin-right: 10px">是否回款:</span>
              <el-radio-group v-model="radio">
                <el-radio :label="1">已回</el-radio>
                <el-radio :label="2">未回</el-radio>
                <el-radio :label="3">不提醒</el-radio>
              </el-radio-group>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24">
              <el-form-item label="备注:" style="width: 830px">
                <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="planreceivable.planreceivableNote"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12" :offset="6">
              <el-form-item>
                <el-button type="primary" @click="addPlanReceivable()">保存</el-button>
                <el-button @click="dialogFormVisible = false">取消</el-button>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <!--内层dialog-->
        <el-dialog width="30%" title="全部客户" :visible.sync="innerDialog" append-to-body>
          <!--选择客户-->
          <el-table :data="customerList" style="width: 100%">
            <el-table-column prop="customerId" label="客户编号" >
            </el-table-column>
            <el-table-column prop="customerName" label="客户名" >
            </el-table-column>
            <el-table-column label="请选择" >
              <template slot-scope="scope">
                <el-button size="mini" @click="choiceCustomer(scope.row)" icon="el-icon-check" type="primary" circle style="margin-left: 10px"></el-button>
              </template>
            </el-table-column>
          </el-table>
          <el-row style="margin-top:10px">
            <el-col :span="16">
              <el-pagination layout="prev, pager, next, jumper" :total="cusTotalSize" @current-change="cusChangePage"
                             :current-page.sync="cusCurrPage" :page-size="cusPageSize"></el-pagination>
            </el-col>
          </el-row>
        </el-dialog>
        <!--内层dialog员工-->
        <el-dialog width="30%" title="人员选择" :visible.sync="innerDialogEmp" append-to-body @close="closeInnerDialogEmp">
          <div>
            <el-collapse v-model="activeName">
              <el-collapse-item v-for ="(dept,index) in deptList" :title="dept.deptName" :key="index" :name="dept.deptId">
                <ul class="emp-ul">
                  <li @click="choiceEmp(emp)" v-for="(emp,index) in dept.employeeByDeptId">
                    <span v-if="index !== dept.employeeByDeptId.length-1" class="line-style"></span>
                    <span v-if="index === dept.employeeByDeptId.length-1" class="line-style-end"></span>
                    <span class="">{{emp.empName}}</span>
                  </li>
                </ul>
              </el-collapse-item>
            </el-collapse>
          </div>
        </el-dialog>
      </el-dialog>
    </el-row>
    <!--计划回款表格-->
    <el-table ref="multipleTable" :data="planreceivableList" tooltip-effect="dark"
              style="width: 100%"  @selection-change="handleSelectionChange" border>
      <el-table-column type="selection" ></el-table-column>
      <el-table-column prop="planreceivableId" label="ID" wsortable sortable></el-table-column>
      <el-table-column prop="planreceivableMoney" label="金额" ></el-table-column>
      <el-table-column prop="planreceivableDate" label="计划回款日期" ></el-table-column>
      <el-table-column prop="contractByContractId.contractTheme" label="合同订单" >
        <template slot-scope="scope">
          <div style="color: #333333">
            <span>{{scope.row.contractByContractId.contractTheme}}</span>
            <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
              <router-link :to="{path:'/ContractView',query: {contractId: scope.row.contractByContractId.contractId}}">
                  <span style="color: #333333">
                    <i class="el-icon-s-opportunity"></i>
                  </span>
              </router-link>
            </el-tooltip>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="customerByCustomerId.customerName" label="客户" >
        <template slot-scope="scope">
          <div style="color: #333333">
            <span>{{scope.row.customerByCustomerId.customerName}}</span>
            <el-tooltip class="item" effect="dark" content="打开详细页面" placement="bottom">
              <router-link :to="{path:'/CustomerView',query: {customerId: scope.row.customerByCustomerId.customerId}}">
                  <span style="color: #333333">
                    <i class="el-icon-s-opportunity"></i>
                  </span>
              </router-link>
            </el-tooltip>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="planreceivableIssue" label="期次" ></el-table-column>
      <el-table-column prop="planreceivableBack" label="是否回款" >
        <template slot-scope="scope">
          <span v-if="scope.row.planreceivableBack == 1">{{ztOptions[0].label}}</span>
          <span v-if="scope.row.planreceivableBack == 2">{{ztOptions[1].label}}</span>
          <span v-if="scope.row.planreceivableBack == 3">{{ztOptions[2].label}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="employeeByEmpId.empName" label="负责人" ></el-table-column>
      <el-table-column prop="" label="操作" width="135px">
        <template slot-scope="scope">
            <router-link :to="{path:'/planreceivableview',query:{backId:scope.row.planreceivableId}}">
              <el-tooltip class="item" effect="dark" content="视图" placement="bottom">
                <el-button size="mini"
                           icon="el-icon-tickets" type="success" circle></el-button>
              </el-tooltip>
            </router-link>
            <el-tooltip class="item" effect="dark" content="编辑" placement="bottom">
              <el-button size="mini" @click="handleEdit(scope.row)" icon="el-icon-edit" type="primary" circle style="margin-left: 10px"></el-button>
            </el-tooltip>
            <el-tooltip class="item" effect="dark" content="删除" placement="bottom">
              <el-button size="mini" @click="handleDelete(scope.row)" icon="el-icon-delete" type="danger" circle></el-button>
            </el-tooltip>
        <!--  </div>-->
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-row style="margin-top:10px">
      <el-col :span="8">
        <el-tooltip class="item" effect="dark" content="删除" placement="bottom">
          <el-button style="padding: 12px 12px" icon="el-icon-delete" @click="handleDeleteMany" type="danger"></el-button>
        </el-tooltip>
      </el-col>
      <el-col :span="16">
        <el-pagination layout="sizes,prev,pager, next, jumper" :total="totalSize" @current-change="changePage"
                       :current-page.sync="currPage" :page-size="pageSize" :page-sizes="pageSizes" @size-change="changeSize"></el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
  import {formatTimeToStr} from "../assets/format";

  export default {
  data () {
    return {
      changeEmp:true, // 是否可以改变负责人
      activeName: [],
      deptList:[],
      emp:{},
      pageSize: 10, // 分页页大小
      pageSizes:[10,20,30],//页大小数组
      approvalRecordList:[],
      dialogFormVisible: false,
      planreceivableList:[],//视图集合分页
      contractList:[],
      customerList: [], // 员工客户名称
      contactList: [], // 员工联系人集合
      pageSize: 5, // 分页页大小
      currPage: 1, // 当前页码，默认为1
      totalSize: 0, // 总记录数
      cusPageSize: 5, // 分页页大小
      cusCurrPage: 1, // 当前页码，默认为1
      cusTotalSize: 0, // 总记录数
      rules: {
        planreceivableMoney: [
          { required: true, message: '请填写', trigger: 'change' },
        ],
        planreceivableEmpName:[
          { required: true, message: '必须填', trigger: 'blur' }
        ],
        planreceivableIssue: [
          { required: true, message: '必选', trigger: 'change' }
        ],
        'customerByCustomerId.customerName': [
          { required: true, message: '请选择客户', trigger: 'blur' }
        ],
        'employeeByEmpId.empName': [
          { required: true, message: '请选择负责人', trigger: 'blur' }
        ],
        'contractByContractId':[
          { required: true, message: '请选择合同', trigger: 'blur' }
        ]
      },
      planreceivable: {
        employeeByEmpId:'',//所有者(负责人)
        planreceivableId:0,
        planreceivableDate:'',//回款日期
        planreceivableNote:'',//备注
        planreceivableBack:'',//是否回款
        planreceivableIssue:'',//期次
        planreceivableMoney:'0.0',//金额
        planreceivableEmpName:'',//所有者
        planreceivablePrincipal:'',//负责人
        customerByCustomerId:'',//客户
        contractByContractId:'',//合同订单
        employeeByAppEmpId:null,
        planreceivableAppStatus:0
      },
      isCustomer: true, // 客户搜索显示
      innerDialog: false,// 内层dialog客户
      innerDialogEmp: false,// 内层dialog员工
      content: '',// input内容
      customerValue:'',// 模糊查询客户
      customerList2:[],// 模糊查询结果
      visible: false,// 模糊搜索结果
      /*下拉框条件查询*/
      ztOptions:[{
        value: 0,
        label: '已回'
      }, {
        value: 1,
        label: '未回'
      }, {
        value: 2,
        label: '不提醒'
      }],
      allOptions: [{
        value: 0,
        label: '全部数据'
      },{
        value: 1,
        label: '未回'
      }, {
        value: 2,
        label: '已回'
      }, {
        value: 3,
        label: '不提醒'
      }],
      allValue:'',
      filterOptions: [{
        value: 0,
        label: '全部数据'
      },{
        value: 1,
        label: '未回'
      }, {
        value: 2,
        label: '已回'
      }, {
        value: 3,
        label: '不提醒'
      }],
      filterValue: 0,
      //头部搜索框
      filterValue: 0,
      vagueOptions: [{
        value: 1,
        label: '客户名称'
      },{
        value: 2,
        label: '计划回款日期'
      }],
      vagueValue: 1,
      //弹出框的期次
      periods: [{
        value: 1,
        label: '1'
      }, {
        value: 2,
        label: '2'
      }, {
        value: 3,
        label: '3'
      }, {
        value: 4,
        label: '4'
      }, {
        value: 5,
        label: '5'
      }, {
        value: 6,
        label: '6'
      }],
      //状态
      status: [{
        value: '选项1',
        label: '未付'
      }, {
        value: '选项2',
        label: '已付'
      }, {
        value: '选项3',
        label: '不提醒'
      }],
      radio:2,
      statuvalue:'',
      periodvalue: '',
      // 客户签约人(要从数据库里面查找)
      restaurants: [],
      state: '',
      timeout:  null,

      mulSelection: []
    }
  },
  methods: {
    //打开员工dialog
    openEmpDialog(){
      this.innerDialogEmp = true
      this.findDeptList()
    },
    //查询部门员工
    findDeptList () {
      this.$axios.get('http://localhost:8088/dept-emp-list')
        .then(v => {
          this.deptList = v.data
          for(let i = 1;i <= this.deptList.length;i++){
            this.activeName.push(i)
          }
        })
        .catch(function (v) {})
    },
    //关闭员工diglog事件
    closeInnerDialogEmp(){
      this.activeName = []
    },
    // 查询当前员工
    loginEmp(){
      this.$axios.get('http://localhost:8088/emp')
        .then(v => {
          this.emp = v.data
        })
        .catch(function (v) {})
    },
    initData(currPage, pageSize,filter,vague,content) {
      this.$axios.get('http://localhost:8088/planreceivable-list', {
        params: {
          page: currPage,
          size: pageSize,
          filter:filter,
          vague:vague,
          content:content
        }
      })
        .then(v => {
          this.planreceivableList = v.data.rows
          this.totalSize = v.data.total
        })
        .catch(function (v) {
        })
    },
    changePage(val) {
      this.initData(val, this.pageSize,this.filterValue,this.vagueValue,this.content)
    },
    //改变页大小
    changeSize(val){
      this.pageSize = val
      this.currPage = 1
      this.initData(this.currPage,this.pageSize,this.filterValue,this.vagueValue,this.content)
    },
    // 查询客户所有合同订单
    contractData(cusId) {
      this.$axios.get('http://localhost:8088/cus-contract-list-all', {
        params: {
          cusId: cusId
        }
      })
        .then(v => {
          this.contractList = v.data
        })
        .catch(function (v) {
        })
    },
    // 选择联系人(查询联系人)
    choiceContact(customerId){
      this.$axios.get('http://localhost:8088/contact-list', {
        params: {
          customerId : customerId
        }
      })
        .then(v => {
          this.contactList = v.data
        })
        .catch(function (v) {})
    },
    // 修改数据回显
    handleEdit(val) {
      this.dialogFormVisible = true
      this.radio = val.planreceivableBack
      this.planreceivable.planreceivableId = val.planreceivableId
      this.planreceivable.planreceivableDate = val.planreceivableDate
      this.planreceivable.planreceivableNote = val.planreceivableNote
      this.planreceivable.planreceivableIssue = val.planreceivableIssue
      this.planreceivable.planreceivableMoney = val.planreceivableMoney
      this.planreceivable.contractByContractId = val.contractByContractId
      this.planreceivable.customerByCustomerId = val.customerByCustomerId
      this.planreceivable.employeeByEmpId = val.employeeByEmpId
      this.choiceContact(val.customerByCustomerId.customerId) // 根据客户名查询联系人集合
      this.contractData(val.customerByCustomerId.customerId)
      this.isCustomer = false
     /* this.findAppRecordBy(val.planreceivableId)*/
    },
    //新增
    addPlanReceivable(){
      // 状态
      this.planreceivable.planreceivableBack = this.radio
     this.$refs.plan.validate((valid) => {
        if (valid) {
          this.$axios.post('http://localhost:8088/save-planreceivable',
            {
              planreceivableId:this.planreceivable.planreceivableId,
              planreceivableDate:this.planreceivable.planreceivableDate,
              planreceivableNote:this.planreceivable.planreceivableNote,
              planreceivableBack:this.planreceivable.planreceivableBack,
              planreceivableIssue:this.planreceivable.planreceivableIssue,
              planreceivableMoney:this.planreceivable.planreceivableMoney,
              contractByContractId:this.planreceivable.contractByContractId,
              customerByCustomerId:this.planreceivable.customerByCustomerId,
              employeeByEmpId:this.planreceivable.employeeByEmpId,
            })
            .then(v => {
              // 1、刷新数据
              this.initData(this.currPage, this.pageSize,this.filterValue,this.vagueValue,this.content)
              // 2、关闭弹框
              this.dialogFormVisible = false
              this.$message({
                message: '已保存',
                type: 'success'
              });
            })
            .catch(function (v) {})
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    // 打开dialog事件
    openDialog () {
      if(this.planreceivable.planreceivableId === 0){
        this.planreceivable.employeeByEmpId = this.emp
        this.planreceivable.planreceivableDate = this.addDate()
        this.planreceivable.planreceivableBack = 2
      }
    },
    // 关闭dialog事件
    closeDialog () {
      this.$refs.plan.resetFields()
      this.planreceivable = {
        planreceivableId:0,
        planreceivableDate:'',//回款日期
        planreceivableNote:'',//备注
        planreceivableBack:'',//是否回款
        planreceivableIssue:0,//期次
        planreceivableMoney:'0.0',//金额
        planreceivableEmpName:'',//所有者
        planreceivablePrincipal:'',//负责人
        customerByCustomerId:{},//客户
        contractByContractId:'',//合同订单
        employeeByEmpId: ''
      }
      this.planreceivableList = []
      this.isCustomer = true
      this.contactList = []
      this.contractList = []
    },
    // 打开内层dialog
    innerVisible (cusCurrPage,cusPageSize) {
      this.$axios.get('http://localhost:8088/emp-customer-list', {
        params: {
          page: cusCurrPage,
          size: cusPageSize,
        }
      })
        .then(v => {
          this.customerList = v.data.rows
          this.cusTotalSize = v.data.total
        })
        .catch(function (v) {})
      this.innerDialog = true
    },
    //查询客户分页
    cusChangePage (val) {
      // val就是当前页码
      this.innerVisible(val, this.cusPageSize)
    },
    // 选择客户
    choiceCustomer(val){
      this.planreceivable.customerByCustomerId = val
      console.log(this.planreceivable.customerByCustomerId)
      this.choiceContact(val.customerId)
      this.contractData(val.customerId)
      this.innerDialog = false;
    },
    // 模糊查询客户
    findCustomer(){
      if (this.customerValue != ''){
        this.visible = true
        this.$axios.get('http://localhost:8088/emp-fuzzy-customer-list', {
          params: {
            customerName: this.customerValue
          }
        })
          .then(v => {
            this.customerList2 = v.data
          })
          .catch(function (v) {})
      }else {
        this.visible = false
      }
    },
    // 模糊选择客户
    choiceCustomer2(val){
      console.log(val)
      this.planreceivable.customerByCustomerId = val
      this.choiceContact(val.customerId)
      this.contractData(val.customerId)
      this.visible = false
    },
    // 失去焦点关闭模糊搜索框
    closeEmp(){
      this.visible = false
      this.customerValue = ''
    },
    // 选择员工
    choiceEmp(val){
     /* this.planreceivable.employeeByEmpId = val
      console.log(this.planreceivable.customerByCustomerId)
      this.$axios.get('http://localhost:8088/contact-list', {
        params: {
          customerId : val.customerId
        }
      })
        .then(v => {
          this.contactList = v.data
        })
        .catch(function (v) {})
      this.innerDialog = false;*/
      this.planreceivable.employeeByEmpId = val
      this.innerDialogEmp = false;
    },
    // 删除提示
    handleDelete(val) {
      this.$confirm('此操作将永久删除该回款计划, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deletePlanreceivable(val.planreceivableId)
        this.$message({
          type: 'success',
          message: '删除成功!'
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    // 批量删除提示
    handleDeleteMany () {
      this.$confirm('此操作将永久删除勾选回款计划, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deleteAll()
        this.$message({
          type: 'success',
          message: '删除成功!'
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    // 获取批量删除对象集合
    handleSelectionChange (val) {
      this.mulSelection = val
    },
    // 删除axios
    deletePlanreceivable(planreceivableId) {
      this.$axios.post('http://localhost:8088/delete-planreceivable', this.qs.stringify({planreceivableId: planreceivableId}))
        .then(v => {
          // 1、刷新数据
          this.initData(this.currPage, this.pageSize,this.filterValue,this.vagueValue,this.content)
        })
        .catch(function (v) {
        })
    },
    // 删除所有
    deleteAll() {
      this.mulSelection.forEach(row => {
        this.deletePlanreceivable(row.planreceivableId)
      })
    },
    //客户签约人与我方签约人
    loadAll() {
      return [
        { "value": "陈浩南", "address": "crm工大小组" },
        { "value": "张三疯", "address": "crm工大小组" }
      ];
    },
    querySearchAsync(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;

      clearTimeout(this.timeout);
      this.timeout = setTimeout(() => {
        cb(results);
      }, 3000 * Math.random());
    },
    createStateFilter(queryString) {
      return (state) => {
        return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
      };
    },
    handleSelect(item) {
      console.log(item);
    },
  },
  created:function(){
    this.loginEmp()
    this.initData(this.currPage, this.pageSize,this.filterValue,this.vagueValue,this.content)
  },
  mounted() {
    this.restaurants = this.loadAll();
  },
    filters: {
      formatDate: function(time) {
        if(time!=null&&time!="")
        {
          var date = new Date(time);
          return formatTimeToStr(date, "yyyy-MM-dd hh:mm");
        }else{
          return "";
        }
      }
    }
}
</script>

<style>
  .font-14{
    font-size: 14px
  }
  .col-sm-6 {
    width: 50%;
    position: relative;
    min-height: 1px;

  }
  .text-muted {
    color: #98a6ad;
  }
  .font-13 {
    font-size: 13px !important;
  }
  .text-left{
    text-align: left;
    float: left;
  }
  .text-right {
    text-align: right;
    float: right;
  }
  .form-inline{
    position: relative;
    top: -15px;
    left: 100px;
  }
  .font-14-bold{
    color: #000000;
    font-weight: bold;
  }
</style>
